var http = require('http');

function* doGET() {
    var query = JSON.parse(JSON.stringify(this.request.query));
    return yield this.render('example1', {params: query});
}

function* doPOST() {
    return JSON.stringify({params: this.request.body});
}

module.exports = function *() {
    var ret = '';
    var method = this.method;

    if ('GET' == method) {
        ret = yield doGET.call(this);
    } else if ('POST' == method) {
        ret = yield doPOST.call(this);
    }

    return ret;
};
